import axios from "axios";
import nProgress from "nprogress";
import "nprogress/nprogress.css"



const sphRequest = axios.create({
    baseURL:"/api"
})


sphRequest.interceptors.request.use(
    config=>{
        nProgress.start()
        return config
    },
    error=>{
        // console.log(error);
        return new Promise({error})
    }
)

sphRequest.interceptors.response.use(
    response => {
        nProgress.done()
        return response
    },
    error => {
        return new Promise({error})
    }
)

export default sphRequest
